import request from '@/utils/request'

// 查询培养计划课程明细列表
export function listProgramPourses(query) {
  return request({
    url: '/trainingManagement/programPourses/list',
    method: 'get',
    params: query
  })
}
// 根据状态列表查询查询培养计划课程明细列表
export function listProgramPoursesOfstatus(data) {
  return request({
    url: '/trainingManagement/programPourses/listOfStatusList',
    method: 'post',  // 改为POST方法
    data: data       // 使用data传递请求体参数
  })
}


// 查询培养计划课程明细详细
export function getProgramPourses(id) {
  return request({
    url: '/trainingManagement/programPourses/' + id,
    method: 'get'
  })
}

// 新增培养计划课程明细
export function addProgramPourses(data) {
  return request({
    url: '/trainingManagement/programPourses',
    method: 'post',
    data: data
  })
}

// 修改培养计划课程明细
export function updateProgramPourses(data) {
  return request({
    url: '/trainingManagement/programPourses',
    method: 'put',
    data: data
  })
}

// 删除培养计划课程明细
export function delProgramPourses(id) {
  return request({
    url: '/trainingManagement/programPourses/' + id,
    method: 'delete'
  })
}
// 根据培养方案id查询培养方案课程信息
export function getProgramPoursesByTrainingId(id) {
  return request({
    url: '/trainingManagement/programPourses/selecttrainingProgramCoursesByTrainingProgramId/' + id,
    method: 'get'
  })
}

// 批量新增培养计划课程明细
export function batchAddProgramCourses(data) {

  return request({
    url: '/trainingManagement/programCourses/batchAdd', // 对应 Controller 的 @PostMapping("/batchAdd")
    method: 'post',
    data: data // 传递课程列表数据
  });
}
// 生成分班名单
export function generateClassList(data) {
  return request({
    url: '/student/studentManger/generateClassList',
    method: 'post',
    data: data
  });
}

// 保存手动分班结果
export function saveManualClassDivision(data) {
  return request({
    url: '/student/studentManger/saveManualClassDivision', // 与培养计划课程模块路径保持一致
    method: 'post',
    data: data // 接收手动分班的班级及学生数据
  });
}

// 根据ID修改状态
export function updateStatusById(id, status) {
  return request({
    url: `/trainingManagement/programPourses/updateStatusById/${id}/${status}`,
    method: 'put'
  })
}
